package com.eling.elcms.travel.model;

import com.eling.elcms.core.dao.annotation.CriteriaEnhancer;
import com.eling.elcms.core.dao.annotation.CriteriaEnhancers;
import com.eling.elcms.core.dao.hibernate.OrderCriteriaEnhancer;
import com.eling.elcms.core.dao.hibernate.search.EnumBridge;
import com.eling.elcms.core.model.BaseModel;
import com.eling.elcms.system.model.CommonUser;
import com.eling.elcms.travel.model.CheckInImplement.CheckStatus;
import org.hibernate.search.annotations.*;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

/**
 * 入住餐饮
 * @author wulina
 *
 */
@Entity
@Table(name = "travel_checkindinner")
@Indexed
@CriteriaEnhancers(criteriaEnhancers = {
		@CriteriaEnhancer(impl = OrderCriteriaEnhancer.class) })
public class CheckInDinner extends BaseModel{

	private static final long serialVersionUID = 6608662465552662126L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@DocumentId
	private Long pkCheckInDinner;
	
	/** 入住准备落实 */
	@OneToOne(fetch = FetchType.LAZY, mappedBy = "checkInDinner")
	@IndexedEmbedded(depth = 1)
	private CheckInImplement checkInImplement;
	
	/** 餐饮类型*/
	@OneToMany(mappedBy = "checkInDinner", cascade = CascadeType.MERGE)
	@IndexedEmbedded(depth = 1)
	private Set<Dinner>  dinners;
	
	/** 是否用餐 */
	@Column
	private Boolean haveDinner;	
	
	/** 早餐 */
	@Column
	private Boolean breakfast;
	
	/** 早餐落实 */
	@Column
	private Boolean breakfastConfirm;
	
	/** 午餐 */
	@Column
	private Boolean lunch;
	
	/** 午餐落实 */
	@Column
	private Boolean lunchConfirm;
	
	/** 晚餐 */
	@Column
	private Boolean supper;
	
	/** 晚餐落实 */
	@Column
	private Boolean supperConfirm;	
	
	/** 备注 */
    @Column(length = 1023)
    @Field
	private String description;	
	
	/** 处理人 */
    @ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name = "operator")
	@IndexedEmbedded(depth = 1)
	private CommonUser operator;
	
	/** 处理时间 */
    @Column
	private Date operateDate;   
    
    /** 状态	无要求，待落实，已落实 */
    @Enumerated(EnumType.STRING)
    @Field
    @FieldBridge(impl = EnumBridge.class)
    private CheckStatus status;
	
	@Version
	private Integer version;

	public Long getPkCheckInDinner() {
		return pkCheckInDinner;
	}

	public Boolean getBreakfastConfirm() {
		return breakfastConfirm;
	}

	public void setBreakfastConfirm(Boolean breakfastConfirm) {
		this.breakfastConfirm = breakfastConfirm;
	}

	public void setPkCheckInDinner(Long pkCheckInDinner) {
		this.pkCheckInDinner = pkCheckInDinner;
	}

	public CheckInImplement getCheckInImplement() {
		return checkInImplement;
	}

	public void setCheckInImplement(CheckInImplement checkInImplement) {
		this.checkInImplement = checkInImplement;
	}

	public Boolean getHaveDinner() {
		return haveDinner;
	}

	public void setHaveDinner(Boolean haveDinner) {
		this.haveDinner = haveDinner;
	}

	public Boolean getBreakfast() {
		return breakfast;
	}

	public void setBreakfast(Boolean breakfast) {
		this.breakfast = breakfast;
	}

	public Boolean getLunch() {
		return lunch;
	}

	public void setLunch(Boolean lunch) {
		this.lunch = lunch;
	}

	public Boolean getLunchConfirm() {
		return lunchConfirm;
	}

	public void setLunchConfirm(Boolean lunchConfirm) {
		this.lunchConfirm = lunchConfirm;
	}

	public Boolean getSupper() {
		return supper;
	}

	public void setSupper(Boolean supper) {
		this.supper = supper;
	}

	public Boolean getSupperConfirm() {
		return supperConfirm;
	}

	public void setSupperConfirm(Boolean supperConfirm) {
		this.supperConfirm = supperConfirm;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public CommonUser getOperator() {
		return operator;
	}

	public void setOperator(CommonUser operator) {
		this.operator = operator;
	}

	public Date getOperateDate() {
		return operateDate;
	}

	public void setOperateDate(Date operateDate) {
		this.operateDate = operateDate;
	}

	public CheckStatus getStatus() {
		return status;
	}

	public void setStatus(CheckStatus status) {
		this.status = status;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

	public Set<Dinner> getDinners() {
		return dinners;
	}

	public void setDinners(Set<Dinner> dinners) {
		this.dinners = dinners;
	}

}
